package vue.actions;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.accessibility.Accessible;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import DB.Personne;

import modele.Acces;
import vue.FenetrePrincipale;

@SuppressWarnings("unused")
public class dialogJournal extends JDialog implements ActionListener{
	private FenetrePrincipale mere;
	private JPanel panTable;
	private JTable tablePersonnes;
	
	private static final long serialVersionUID = 1L;

	public dialogJournal(FenetrePrincipale fp)
	{
		super(fp);
		this.setMere(fp);
		this.setBounds(500, 500, 600, 500);
		
		this.creeTablePersonneComplete();
		
		this.getContentPane().setLayout(null);
		this.getContentPane().add(this.panTable);
		this.setVisible(true);
	}

	private void creeTablePersonneComplete()
	{
		this.panTable = new JPanel();
		this.panTable.setSize(600,500);
		
		Object[][] valeurTable = new Object[this.mere.getControleur().getJournal().getAcces().size()][1];
		Object[] col = {"Acces"};
		int i =0;
		for(Acces p : this.mere.getControleur().getJournal().getAcces())
		{
			valeurTable[i++][0]=p;
		}
		this.tablePersonnes = new JTable(valeurTable,col);
		JScrollPane sc = new JScrollPane(this.tablePersonnes);
		this.panTable.add(sc);
		
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		
	}

	/**
	 * @return the mere
	 */
	public FenetrePrincipale getMere() {
		return mere;
	}

	/**
	 * @param mere the mere to set
	 */
	public void setMere(FenetrePrincipale mere) {
		this.mere = mere;
	}
}
